package com.bwie.controller;

import com.bwie.common.pojo.po.GoodsPo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Objects;

@RestController
public class DictController {
    @Autowired
    private RedisTemplate redisTemplate;
    @GetMapping("/getDictGoods")
    public List<GoodsPo> redisGoods(){
        List<GoodsPo> list = (List<GoodsPo>) redisTemplate.opsForHash().get("goods:list:msg", "Watanabe Hana");
        list.stream()
                .filter(goodsPo -> Objects.equals(1,goodsPo.getGoodsId()))
                .findFirst().get();
        return list;
    }
}
